/*
 * Main.cpp
 *
 *  Created on: 09-Oct-2013
 *      Author: sriram
 */
#include <iostream>
#include <string>
#include "Test/MemoryTest.h"
#include "dependency/GlobalVariables.h"
#include "dependency/GlobalConstants.h"
#include "Test/BufferTest.h"
#include "Utils/Timer.h"
#include "UXManager/SqlEditor.h"
#include "UXManager/BMEditor.h"
#include "UXManager/IndexEditor.h"
#include "BufferManager/BufferManager.h"
using namespace std;

int main() {
    cout << "Well-come to ri3db!" << endl;
    //cout<<sizeof (int)<< sizeof( float);

    string input;
    //	cout<<"# ";
    //	cin>>input;
    //	while(input.compare("exit")){
    //		// Process Input here - Interpreter menu
    //		cout<<"# ";
    //		cin>>input;
    //	}
    // Test Modules

    //	MemoryTest::execute();



    //	cout<<"\nparsed!"<<endl;
    //	BufferTest bt;
    //	TimeUtil t;
    //	t.startTimer();
    //	bt.checkBMFunc();
    //	t.endTimer();
    //	cout << "\n checked"<<endl;
    SqlEditor sql;
    BMEditor bm;
    IndexEditor indexEditor;
    while (1) {
        cout << "\nEnter mode: SQL, BM, INDEX, EXIT #";
        string io;
        cin >> io;
        if (io.compare("SQL")==0 || io.compare("sql")==0)
            sql.showEditor();
        else if (io.compare("BM")==0 || io.compare("bm")==0)
            bm.showEditor();
        else if (io.compare("INDEX")==0 || io.compare("index")==0)
            indexEditor.showEditor();
        else if (io.compare("EXIT")==0   || io.compare("exit")==0) {
            
            BufferManager *bm = bm->getInstance();
            if (isDBOpen == true)
                DEBUG("CLOSING DB");
                bm->closeDB();
            break;
        }


    }
    return 0;

}




